home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1996 #15 / Monster Media Number 15 (Monster Media)(July 1996).ISO / os2 / srefv112.zip / USETABL2.RXX < prev    next >
Text File  |  1996-05-10  |  3KB  |  96 lines

  1. /* this is the USETABL2 Rexx-code block, to be called as a
  2. file using the INTERPRET FILE USETABL2.RXX keyphrase. 
  3. It is a more sophisticated version of the USE_TABLE code block
  4. (that appears in INTERPET.IN)
  5.  
  6. You can modify this list by adding "user-agent identifiers" to
  7.      the TABLE_LIST and  NO_TABLE_LIST stem variables.
  8.  
  9. */
  10.  
  11. /* -- add "table capable browser" User-agent identifiers here -- */
  12.    table_list.1='IBM WebExplorer DLL /v1.03' ;
  13.    table_list.2="Mozilla/2.0";
  14.   table_list.3="Mozilla/1.1";
  15.   table_list.4="Mozilla/1.2";
  16.   table_list.5="Mozilla/1.3";
  17.    table_list.6="IBM-WebExplorer-DLL/v1.1";
  18.   table_list.0=6 ;
  19.  
  20.   /* -- add " not table capable browser" User-agent identifiers here -- */
  21.    no_table_list.1='IBM WebExplorer DLL /v1.01' ;
  22.    no_table_list.2='IBM WebExplorer DLL /v1.00' ;
  23.    no_table_list.3="Mozilla/1.0";
  24.    no_table_list.0=3 ;
  25.  
  26.   /* -- do not change below here --- */
  27.  
  28.    putme=reqfield("User-Agent") ;
  29.  
  30.    isat=lastpos('.',docname);
  31.    docname0=docname ;
  32.    if isat>0 then
  33.       docname0=delstr(docname,isat) ;
  34.  
  35.    docname1=0 ;
  36.    if symbol('optlist.0')='VAR' then do ;
  37.      do tmp1z=1 to optlist.0;
  38.        parse upper var optlist.tmp1z tmp.1 '=' tmp.2;
  39.        if tmp.1="TABLE" & tmp.2="YES" then do;
  40.           docname1=docname0||'.TBL' ; leave ; end;
  41.        if tmp.1="TABLE" & tmp.2="NO" then do ;
  42.            docname1=docname0||'.DEF' ; leave ; end ;
  43.      end;
  44.    end ;
  45.  
  46.    if docname1=0 then do ;
  47.       do smm=1 to table_list.0 ;
  48.         if abbrev(translate(putme),translate(table_list.smm))=1 then do;
  49.            docname1=docname0||'.TBL' ; leave ;
  50.         end ;
  51.      end;
  52.    end;
  53.    if docname1=0 then do ;
  54.       do smm=1 to no_table_list.0 ;
  55.  
  56.         if abbrev(translate(putme),translate(no_table_list.smm))=1 then do;
  57.            docname1=docname0||'.DEF' ; leave ;
  58.         end ;
  59.      end;
  60.    end;
  61.  
  62.  
  63.    IF DOCNAME1<>0 THEN   do ;             
  64.       interpret.results=delim_1.1||'INCLUDE  '||docname1||delim_2.1 ;
  65.    END ;
  66.  
  67.    else do  ;       
  68.        aac='?';
  69.        if pos('?',seloriginal)>0 then aac="&" ;
  70.        themess="" ;
  71.        putme=reqfield("User-Agent");
  72.        tmp.1="<html><head><title> Table Version Check </title></head> <body> " ;
  73.        tmp.2=" <h2> The requested document contains an optional table </h2> ";
  74.        tmp.3=" <br> and our server can't tell whether your browser supports table! ";
  75.        tmp.4=" <p> <em>  Please select either ..</em> <blockquote>" ;
  76.        tmp.5='<p>     the <a href="/'||seloriginal||aac||'TABLE=YES">  .. TABLE version </a>' ;
  77.  
  78.        tmp.6='<p> or the <a href="/'||seloriginal||aac||'TABLE=NO"> .. non-table version </a>' ;
  79.        tmp.7='</blockquote> of the requested document: ' docname;
  80.        tmp.8='<p> Hint: if you see a little table below... your browser <strong>can</strong> handle tables! ' ;
  81.        tmp.9="<table border=1><th>Headings <th>Col 1 <th> col 2<th> col 3 " ;
  82.        tmp.10="<tr> <td> Row is.. </td> <td> r1 c1 </td <td> r1 c2 </td> ";
  83.        tmp.11='<td> r1 c2 </td> <td> last spot </td> </table> ' ;
  84.        tmp.12='<hr> FYI: Your browser claims to be :<em>' putme   '</em>';
  85.        tmp.13="</body></html> ";
  86.  
  87.        themess=tmp.1;
  88.        do tmpi=2 to 13 ;
  89.          themess=themess||tmp.tmpi ;
  90.        end ;
  91.        'var type text/html  as ' docname ' NAME themess '  ;
  92.  
  93.     exit ;
  94.    end ;
  95.  
  96.